package com.ctshk.sapp.order.scenic.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.rpc.order.scenic.dto.AirshowOrderAgentListDTO;
import com.ctshk.rpc.order.scenic.req.*;
import com.ctshk.rpc.order.scenic.service.IAirshowOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.ctshk.common.web.support.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 周億耀
 * @since 2021-06-15
 */
@RestController
@RequestMapping("/airshow-order")
@Api(value="珠海航展订单服务", tags="珠海航展订单服务")
public class AirshowOrderController extends BaseController {

    @DubboReference
    private IAirshowOrderService iAirshowOrderService;

    @ApiOperation(value = "珠海航展-分销商套票下单", notes = "珠海航展-分销商套票下单")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.ADD, operTitle = "珠海航展-分销商套票下单", operDesc = "珠海航展-分销商套票下单")
    @PostMapping(value = "/agent-create-package-order")
    public Result agentCreatePackageOrder(@RequestBody AirshowOrderCreateReq airshowOrderCreateReq){
        return iAirshowOrderService.agentCreatePackageOrder(airshowOrderCreateReq,getCurrentUser(getRequest()),1);
    }

    @ApiOperation(value = "珠海航展-分销商套票计算价格", notes = "珠海航展-分销商套票计算价格")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.ADD, operTitle = "珠海航展-分销商套票下单", operDesc = "珠海航展-分销商套票下单")
    @PostMapping(value = "/agent-package-price")
    public Result agentPackagePrice(@RequestBody AirshowOrderCreateReq airshowOrderCreateReq){
        return iAirshowOrderService.agentPackagePrice(airshowOrderCreateReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "珠海航展-分销商api下单", notes = "珠海航展-分销商api下单")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.ADD, operTitle = "珠海航展-分销商api下单", operDesc = "珠海航展-分销商api下单")
    @PostMapping(value = "/agent-create-api-order")
    public Result agentCreateAPIOrder(@RequestBody AirshowOrderCreateReq airshowOrderCreateReq){
        return iAirshowOrderService.agentCreateAPIOrder(airshowOrderCreateReq,getCurrentUser(getRequest()),1);
    }

    @ApiOperation(value = "珠海航展-分销商api价格计算", notes = "珠海航展-分销商api价格计算")
    @PostMapping(value = "/agent-api-price")
    public Result agentAPIPrice(@RequestBody AirshowOrderAPIPriceReq airshowOrderAPIPriceReq){
        return iAirshowOrderService.agentAPIPrice(airshowOrderAPIPriceReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "珠海航展-通过订单ID查询订单", notes = "珠海航展-通过订单ID查询订单")
    @PostMapping(value = "/get-order-by-id")
    public Result getOrderById(Long id){
        return iAirshowOrderService.getOrderById(id);
    }

    @ApiOperation(value = "珠海航展-分销商订单发起退票申请", notes = "珠海航展-分销商订单发起退票申请")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.UPDATE, operTitle = "珠海航展-分销商订单发起退票", operDesc = "珠海航展-分销商订单发起退票")
    @PostMapping(value = "/agent-cancel-order-by-id")
    public Result agentCancelOrderById(@RequestBody AirshowOrderCancelReq airshowOrderCancelReq){
        return iAirshowOrderService.agentCancelOrderById(airshowOrderCancelReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "珠海航展-分销商查询订单列表", notes = "珠海航展-分销商查询订单列表")
    @PostMapping(value = "/get-agent-order-list-by-params")
    public Result getAgentOrderListByParams(@RequestBody AirshowOrderListReq airshowOrderListReq){
        return iAirshowOrderService.getAgentOrderListByParams(airshowOrderListReq,getCurrentUser(getRequest()));
    }




}
